package com.hspedu.homework;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/1/29
 * @time 19:45
 */
public class Homework07 {
    public static void main(String[] args) {
        Car car = new Car(50);
        Car car1 = new Car(-1);
        Car car2 = new Car(17);
        Car.Air air = car.new Air();
        Car.Air air1 = car1.new Air();
        Car.Air air2 = car2.new Air();

        air.flow();
        air1.flow();
        air2.flow();
    }
}

class Car{
    private int temperature;

    public Car(int temperature) {
        this.temperature = temperature;
    }

    class Air{
        public void flow(){
            if (temperature > 40){
                System.out.println("现在的温度是"+temperature+"吹冷风");
            }else if (temperature < 0){
                System.out.println("吹暖气");
            }else{
                System.out.println("关闭空调");
            }
        }
    }
}
